// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ColumnViewModel.cs" company="Akzente.IT">
//   (c) 2012 Akzente.IT
// </copyright>
// <summary>
//   The column view model.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace AkzenteIT.DatabaseDocumentationTool.ViewModels
{
    using AkzenteIT.DatabaseDocumentationTool.Extensions;
    using AkzenteIT.DatabaseDocumentationTool.ViewModels.Base;

    using Microsoft.SqlServer.Management.Smo;

    /// <summary>
    /// The column view model.
    /// </summary>
    public class ColumnViewModel : DbObjectViewModel<Column>
    {
        #region Constructors and Destructors

        /// <summary>
        /// Initializes a new instance of the <see cref="ColumnViewModel"/> class.
        /// </summary>
        /// <param name="parent">
        /// The parent.
        /// </param>
        /// <param name="column">
        /// The column.
        /// </param>
        public ColumnViewModel(NodeViewModel parent, Column column)
            : base(parent, column)
        {
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the description.
        /// </summary>
        public override string Description
        {
            get
            {
                return this.Model.ExtendedProperties.GetDescription();
            }

            set
            {
                this.Model.ExtendedProperties.SetDescription(value);
                this.NotifyPropertyChanged("Description");
            }
        }

        /// <summary>
        /// Gets the name.
        /// </summary>
        public override string Name
        {
            get
            {
                return this.Model.Name;
            }
        }

        #endregion
    }
}